<!DOCTYPE html>
<title>Fully exit fullscreen with single element on stack</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../trusted-click.js"></script>
<script src="fully-exit-fullscreen.js"></script>
<div id="log"></div>
<div id="single"></div>
<script>
async_test(function(t)
{
    var single = document.getElementById("single");
    trusted_request(t, single);
    document.onfullscreenchange = t.step_func(function()
    {
        assert_equals(document.fullscreenElement, single);
        trusted_click(t, fully_exit_fullscreen.bind(null, document), single);
        document.onfullscreenchange = t.step_func(function()
        {
            assert_equals(document.fullscreenElement, null);
            t.done();
        });
    });
});
</script>
